package com.news.model;

public class Comment {
    private int commentId;
    private int newsId; // 外键，关联新闻ID
    private int userId; // 外键，关联用户ID
    private String content;
    private long createdAt;
    private Integer parentId; // 可选，关联回复的评论ID
    private String userName;

    public Comment() {}
    public Comment(int newsId, int userId, String content, long createdAt,String userName){
        this.newsId = newsId;
        this.userId = userId;
        this.content = content;
        this.createdAt = createdAt;
        this.userName = userName;
    }
    public Comment(int commentId, int newsId, int userId, String content, long createdAt) {
        this.commentId = commentId;
        this.newsId = newsId;
        this.userId = userId;
        this.content = content;
        this.createdAt = createdAt;
    }



    public int getCommentId() {
        return commentId;
    }

    public void setCommentId(int commentId) {
        this.commentId = commentId;
    }

    public int getNewsId() {
        return newsId;
    }

    public void setNewsId(int newsId) {
        this.newsId = newsId;
    }

    public int getUserId() {
        return userId;
    }

    public void setUserId(int userId) {
        this.userId = userId;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public long getCreatedAt() {
        return createdAt;
    }

    public void setCreatedAt(long createdAt) {
        this.createdAt = createdAt;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public Integer getParentId() {
        return parentId;
    }

    public void setParentId(Integer parentId) {
        this.parentId = parentId;
    }

    @Override
    public String toString() {
        return "Comment{" +
                "commentId=" + commentId +
                ", newsId=" + newsId +
                ", userId=" + userId +
                ", content='" + content + '\'' +
                ", createdAt=" + createdAt +
                ", parentId=" + parentId +
                ", userName='" + userName + '\'' +
                '}';
    }

    // 构造方法、getter和setter方法在此省略
}